<template>
    <div id="app">
        <router-view></router-view>
    </div>
</template>

<script>

    export default {
        name: 'App',
        created() {
            this.$router.push({name:'loading'})
            setTimeout(this.init,2000)
        },
        methods: {
            init() {
                //获取token
                let token = localStorage.getItem("token");
                console.log('token:' + token);
              if (token) {
                console.log('token:' + token);
                  this.$router.push({name: 'admin'})
              } else {
                this.$router.push({name: 'login'})
              }
            },
        }
    }
</script>
<style lang="less">
    body {
        margin: 0;
    }
</style>